<%--
  Created by IntelliJ IDEA.
  User: lzc
  Date: 2018/4/12
  Time: 14:58
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<html>
<head>
    <title>搜索结果</title>
    <!-- Custom Theme files -->
    <link href="${pageContext.request.contextPath}/css/resultList.css?version=1.05" rel="stylesheet" type="text/css"
          media="all"/>
    <link href="${pageContext.request.contextPath}/css/jquery.page.css?version=1.01" rel="stylesheet" type="text/css"
          media="all"/>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/layui/css/layui.css">
    <!-- Custom Theme files -->
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>

    <script src="${pageContext.request.contextPath}/jquery/jquery.min.js"></script>
    <script src="${pageContext.request.contextPath}/layui/layui.js" charset="utf-8"></script>

    <style type="text/css">
        div.pagination {
            height: 20px;
            /*float: right;*/
            margin-bottom: 10px;
        }
        /*div.pagination a,*/
        div.pagination span {
            height: 18px;
            line-height: 18px;
            display: inline;
            float: left;
            margin-left: 3px;
            text-align: center;
            vertical-align: middle;
            white-space: nowrap;
            outline: none;
            blr: expression(this.hideFocus = true);
        }

        /*div.pagination a {*/
            /*padding: 0px 5px;*/
            /*border: 1px solid #cccccc;*/
        /*}*/

        div.pagination a:hover {
            border: 1px solid #fd6d01;
            text-decoration: none;
        }

        div.pagination a.previousPage {
            width: 18px;
            padding: 0px;
            background: url(images/common.gif) 0px -180px no-repeat;
        }

        div.pagination span.previousPage {
            width: 18px;
            cursor: default;
            border: 1px solid #cccccc;
            background: url(images/common.gif) -30px -180px no-repeat;
        }

        div.pagination a.nextPage {
            width: 18px;
            padding: 0px;
            background: url(images/common.gif) 0px -210px no-repeat;
        }

        div.pagination span.nextPage {
            width: 18px;
            cursor: default;
            border: 1px solid #cccccc;
            background: url(images/common.gif) -30px -210px no-repeat;
        }

        div.pagination a.firstPage {
            width: 18px;
            padding: 0px;
            background: url(images/common.gif) -60px -180px no-repeat;
        }

        div.pagination span.firstPage {
            width: 18px;
            cursor: default;
            border: 1px solid #cccccc;
            background: url(images/common.gif) -90px -180px no-repeat;
        }

        div.pagination a.lastPage {
            width: 18px;
            padding: 0px;
            background: url(images/common.gif) -60px -210px no-repeat;
        }

        div.pagination span.lastPage {
            width: 18px;
            cursor: default;
            border: 1px solid #cccccc;
            background: url(images/common.gif) -90px -210px no-repeat;
        }

        div.pagination .currentPage {
            padding: 0px 5px;
            color: #fd6d01!important;
            font-weight: bold;
            cursor: default;
            border: 1px solid #fd6d01;
            background-color: #ffede1;
        }

        div.pagination .pageBreak {
            padding: 0px 5px;
            color: #3366cc;
            cursor: default;
        }
    </style>
</head>
<body>
<div class="search">
    <div class="s-bar">
        <form action="/test/getDocument" method="get">
            <input  type="hidden" name="currentPage" value="">
            <input type="text" value="${doc_title}" name="doc_title">
            <input type="submit" value="搜索" id="btn"/>
        </form>
    </div>
</div>
<div class="resultList">
    <div class="resultList_1">
        <hr>
        <c:forEach items="${resultList}" var="obj">
            <div class="list_1"
                 style="font-size: 16px; color: blue;"><a href="${pageContext.request.contextPath}/test/getDetailByDocId?doc_id=${obj.docId}">${obj.docTitle}</a><br><span style="font-size: 14px;">贡献者：${obj.docAuthor}&nbsp;&nbsp;&nbsp;文件大小：<fmt:formatNumber type="number" value="${obj.docSize/1024 }" pattern="0.00" maxFractionDigits="2"/> KB&nbsp;&nbsp;&nbsp;下载量：${obj.downloads}&nbsp;&nbsp;&nbsp;文件类型：${obj.docType}</span></div>
            <hr>
        </c:forEach>
        <div class="pagination">
            <span>第 ${currentPage} 页</span>
            <c:if test="${currentPage} != 1">
                <a href="${pageContext.request.contextPath}/test/getDocument?doc_title=${doc_title}&currentPage=1" class="firstPage"></a>
                <a href="${pageContext.request.contextPath }/test/getDocument?doc_title=${doc_title}&currentPage=${currentPage - 1}" class="previousPage"></a>
            </c:if>

            <c:forEach var="i" begin="1" end="${totalPage }">
                <a href="${pageContext.request.contextPath }/test/getDocument?doc_title=${doc_title}&currentPage=${i }"><span class="currentPage">${i }</span></a>
            </c:forEach>

            <%--<c:choose>--%>
                <%--<c:when test="${totalPage} <= 10">--%>
                    <%--<c:forEach var="i" begin="1" end="${totalPage }">--%>
                        <%--<a href="${pageContext.request.contextPath }/test/getDocument?doc_title=${doc_title}&currentPage=${i }"><span class="currentPage">${i }</span></a>--%>
                    <%--</c:forEach>--%>
                <%--</c:when>--%>

                <%--<c:otherwise>--%>
                    <%--<c:choose>--%>
                        <%--<c:when test="${currentPage } <= 6">--%>
                            <%--<c:forEach var="i" begin="1" end="10">--%>
                                <%--<a href="${pageContext.request.contextPath }/test/getDocument?doc_title=${doc_title}&currentPage=${i }"><span class="currentPage">${i }--%>
                            <%--</c:forEach>--%>
                        <%--</c:when>--%>
                        <%--<c:otherwise>--%>
                            <%--<c:choose>--%>
                                <%--<c:when test="${totalPage - currentPage} <= 5">--%>
                                    <%--<c:forEach var="i" begin="${totalPage -10}" end="${totalPage}">--%>
                                        <%--<a href="${pageContext.request.contextPath }/test/getDocument?doc_title=${doc_title}&currentPage=${i }"><span class="currentPage">${i }--%>
                                    <%--</c:forEach>--%>
                                    <%--<c:otherwise>--%>
                                        <%--<c:forEach var="i" begin="${currentPage - 5 }" end="${currentPage + 5}">--%>
                                            <%--<a href="${pageContext.request.contextPath }/test/getDocument?doc_title=${doc_title}&currentPage=${i }"><span class="currentPage">${i }--%>
                                        <%--</c:forEach>--%>
                                    <%--</c:otherwise>--%>
                                <%--</c:when>--%>
                            <%--</c:choose>--%>
                        <%--</c:otherwise>--%>
                    <%--</c:choose>--%>
                <%--</c:otherwise>--%>
            <%--</c:choose>--%>

            <c:if test="${currentPage} != ${$totalPage }">
                <a class="nextPage" href="${pageContext.request.contextPath }/test/getDocument?doc_title=${doc_title}&currentPage=${currentPage + 1 }"></a>
                <a class="lastPage" href="${pageContext.request.contextPath }/test/getDocument?doc_title=${doc_title}&currentPage=${totalPage }"></a>
            </c:if>
            <span>共 ${totalPage } 页</span>
        </div>
    </div>
    <%--<div id="demo2"></div>--%>
</div>
</body>
</html>
